<script type="text/javascript">
$(function(){
    var controller ='{$orderextm.shipping_name}' ? false : true;
    $('#cancel_button').click(function(){
        DialogManager.close('order_shipped');
    });

    $('#their').bind('click', function() {
        $('#warning').empty().hide();
        if ($(this).attr('checked')) {
            controller = false;
            $('#J_shipped_wrap').hide();
        } else {
            controller = true;
            $('#J_shipped_wrap').show();
        }
    });

    $.validator.addMethod("check_type", function(value, element) {
        var go=true;
        if(controller){
            if(element.name === 'express'){
                if($('input[name="express"]:checked').length<1){
                    go=false;
                }
            }else{
                if (value.length < 1) {
                    go = false;
                }
            }
        }
        return go;
    });


    $('#order_shipped').validate({
    errorLabelContainer: $('#warning'),
     rules : {
            invoice_no : {
                check_type   : true
            },
            express : {
                check_type   : true
            }
        },
        messages : {
            invoice_no  : {
                check_type   : '请输入物流单号'
            },
            express  : {
                check_type   : '请选择物流公司'
            }
        }
    });
});

function js_success(dialog_id)
{
    DialogManager.close(dialog_id);
    var url = window.location.href;
    url =  url.indexOf('#') > 0 ? url.replace(/#/g, '') : url;
    window.location.replace(url);
}

function js_fail(str)
{
    $('#warning').html('<label class="error">' + str + '</label>');
    $('#warning').show();
}
</script>
<style>

#warning { border:red 1px solid; background:#FFB7B7; color:#000; padding:3px 10px; margin:8px 0px; display:none; color:#000; font-weight:normal; }
#warning label { display:block; margin:3px 0px; }
#warning label.error { color:#000; font-weight:normal; background: none;}

/* module */
.tab { width: 100%; height: 37px; line-height: 43px; }
.tab li { float: left; margin-right: 2px; cursor: pointer; font-size: 14px; }
.tab .active { height: 26px; color: #E6445B;background: #fff; padding-left: 8px;font-weight: bold;font-size: 16px;}
.tab .normal { height: 26px; color: #3e3e3e; font-weight: bold; padding: 0px; border: 1px solid #e2e2e2; background: #f9f9f9; }
.tab .active a { color: #ff4f01; text-decoration: none; float: left; height: 26px; padding: 0 20px; }
.tab .normal a { color: #3e3e3e; text-decoration: none; float: left; height: 26px; padding: 0 20px; }

.content1 {padding:10px 0 10px 23px;color: #666; }
.content1 h1 {font-size: 16px; color: #000; margin-bottom: 10px;}
.content1 p {margin-bottom: 15px;}
.content1 p span {color: #4b7a10; font-size: 16px; font-weight: bold; }
.content1 dl {width: 332px; padding-bottom: 20px; overflow: hidden;}
.content1 dt {float: left; +padding-top: 5px;}
.content1 dd {float: right; width: 264px;}
.content1 .li {float: left; width: 122px; height: 25px;}
.content1 .btn_sub {text-align: center; word-spacing: 10px; }
.content1 .btn_sub .btn1 {width: 75px; height: 29px; display: inline-block;border: 0; font-weight: bold; font-size: 14px;background: #ccc;color:#fff;
	-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;cursor: pointer;}
.content1 .btn_sub .btn1:hover{background: #e6445b;}
.content1 .btn_sub .btn2 {width: 75px; height: 29px; display: inline-block;border: 0; font-weight: bold; font-size: 14px;background: #ccc;color:#fff;
	-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;cursor: pointer;}
.content1 .btn_sub .btn2:hover{background: #e6445b;}
.content1 .clue_on {color: #9b9b9b; padding-bottom: 20px; line-height: 18px;}
.content1 .pay {padding: 15px;}
.content1 .pb15 {padding-bottom: 15px;}
/*卖家发货*/
#order_shipped dl{ width: auto;}
#order_shipped dd{width:460px; float: left; padding: 0px 10px;}
#order_shipped .seller-order-shipped { height: 150px; overflow: auto;}
#order_shipped .seller-order-shipped li{ float: left; width: 140px; line-height: 25px;}
</style>
<ul class="tab">
    <li class="active">{$lang.shipped_order}{if $order_returns.returns_case gt 1}<font style="color:#000;">({$order_returns.message})</font>{/if}</li>
</ul>
<div class="content1">
    <div id="warning"></div>
    <form method="post" action="index.php?app=order&amp;act=shipped&amp;order_id={$order.order_id}&ajax=1" target="order" id="order_shipped">
        <h1>{$lang.input_invoice_no}</h1>
        <p>
            {$lang.order_sn} : <span>{$order.order_sn}</span>
        </p>
        <p style="background: #f1f1f1;margin-right: 65px;padding:5px 0 5px 10px;font-size: 18px;color:#333;">
            <input type="checkbox" name="their" {if $orderextm.shipping_name eq '自提'}checked{/if} value="自提" id="their" /><label for="their"> 自提</label>
        </p>
        <div {if $orderextm.shipping_name eq '自提'}style="display: none;"{/if} id="J_shipped_wrap">
        <dl>
            <dt>物流公司:</dt>
            <dd>
                <ul class="seller-order-shipped f-cb">
                    <!--{foreach from=$cfg_shipping_kuaidi name=kuaidi key=key item=kuaidi}-->
                    <li>
                        <input type="radio" name="express" id="express_type{$smarty.foreach.kuaidi.index}" value="{$key}" {if $orderextm.shipping_name eq $key}checked{/if} />
                        <label for="express_type{$smarty.foreach.kuaidi.index}">{$key}</label>
                    </li>
                    <!--{/foreach}-->
                </ul>
            </dd>
        </dl>
        <dl>
            <dt>{$lang.invoice_no}:</dt>
            <dd>
                <input type="text" class="text" name="invoice_no" id="invoice_no_input" style="width:195px;" <!--{if $orderextm.shipping_name neq '自提'}--> value="{$order.invoice_no}" <!--{/if}-->  class="search250" />
            </dd>
        </dl>
        </div>
        <div class="btn_sub">
            <!--{if $order_returns.returns_case neq 3}--><input type="submit" id="confirm_button" class="formbtn" value="{$lang.confirm}" /><!--{/if}-->
            <input type="button" id="cancel_button" class="formbtn" value="{$lang.cancel}" />
        </div>
    </form>
</div>